#pragma once
#include "ImageLab.h"
#include <vector>
#include "BasicFunction.h"
using namespace std;

// CImageClustering dialog

class CImageClustering : public CDialog
{
	DECLARE_DYNAMIC(CImageClustering)
	using CDialog::Create;

public:
	CImageClustering(CWnd* pParent);   // standard constructor
	BOOL Create();

	virtual ~CImageClustering();

// Dialog Data
	enum { IDD = IDD_IMAGECLUSTERING };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnOK();
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);

	CWnd*	parent;
	int				dialogid;
	CBasicFunction bf;

private:
//Data members
	vector<string> imagelist;
	vector<unsigned int> imagecluster;
	vector<_3dpoint> imageposition;

	int currenttop;
	int currentselection;

	void UpdateTotalNumber(void);

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedAddimage();
	afx_msg void OnLbnSelchangeImageclusteringImagelist();
	afx_msg void OnLbnSelchangeImageclusteringClusterlist();
	afx_msg void OnBnClickedAddfolder();
	afx_msg void OnBnClickedImageclustering();

public:
	//Normalize the input
	void	NormalizeData(vector<vector<vector<double>>>& input, unsigned int normalizescale);
	void NormalizeData(vector<vector<vector<double> > >& input, vector<vector<double> >& meanvalue, vector<vector<double> >&
		standarddeviation, unsigned int normalizescale);
	void		ClusteringExperiment(void);

	afx_msg void OnBnClickedImageclusteringSorbyimage();
	afx_msg void OnBnClickedImageclusteringSorbycluster();
	afx_msg void OnBnClickedRemovefall();
	afx_msg void OnBnClickedImageclusteringSaveresults();
	afx_msg void OnBnClickedImageclusteringLoadresults();
	afx_msg void OnBnClickedImageclusteringLoaddb();
};
